import cv2
import numpy as np

from GetImagesAndLabels import getImagesAndLabels

def trainFace():
    faceSamples,ids = getImagesAndLabels("./train/")
    # 训练人脸的识别器
    recognizer = cv2.face.LBPHFaceRecognizer_create()
    # 训练人脸数据以及对应的id
    recognizer.train(faceSamples,np.array(ids))
    # 保存人脸的训练结果
    recognizer.write('./data/train.yml')
